
import logging
import requests
import responses_validator
from commons.extract import extract

logger = logging.getLogger("xx")

def runner(k, v, my_var):
        if k == 'request':  # 发送请求
            logger.info('1.正在发送请求...')
            logger.info(f'{v}')
            my_var['resp'] = requests.request(**v)  # 字典使用**
            # print( my_var.status_code)
            # print( my_var.body )

        elif k == 'response':  # 断言响应
            logger.info('1.正在断言...')
            logger.info(f'{v}')
            print(my_var)
            print( "Validation parameters:", v )  # 查看实际传入的验证参数
            responses_validator.validator(my_var['resp'],**v)

        elif k == 'extract':#变量提取
            for var_name, var_exp in v.items():
                value = extract(my_var, *var_exp)  # 列表使用*



        # match k:
        #     case 'request':  #发送请求
        #     case 'response':
        #     case 'extract':  #变量提取


